<form id="form" method="post" action="" enctype="application/x-www-form-urlencoded">
    <div class="content-titulo">
        <h2><?php echo $this->titulo;?></h2>
    </div>

    <div class="orcamento">
            <input type="hidden" name="ORC_ID" value="<?php echo $this->data['ORC_ID']; ?>" />
            <input type="hidden" name="SOL_ID" value="<?php echo $this->data['SOL_ID']; ?>" />
            
            <div class="col1">
                <div class="data"><span class="sep"><label>Data: </label><?php echo Datetools::amd_dma($this->data['ORC_DATA']); ?></span> <label>Hora: </label><?php echo substr($this->data['ORC_HOR'],0,5); ?></div>
                <div class="linha">
                    <table>
                        <tr>
                            <td><label>Empresa:</label><?php echo $this->solicitante->SOL_EMP; ?></td>
                        </tr>
                        <tr>
                            <td><label>Solicitante:</label><?php echo $this->solicitante->SOL_NOM; ?></td>
                        </tr>
                        <tr>
                            <td><label>Telefone:</label><?php echo $this->solicitante->SOL_TEL; ?></td>
                        </tr>
                        <tr>
                            <td><label>E-mail:</label><?php echo $this->solicitante->SOL_EML; ?></td>
                        </tr>
                        <tr>
                            <td><label>Cidade:</label><?php echo $this->solicitante->SOL_CID; ?></td>
                        </tr>
                        <tr>
                            <td><label>UF:</label><?php echo $this->solicitante->SOL_UF; ?></td>
                        </tr>
                        <tr>
                            <td><label>Observação:</label></td>
                        </tr>
                        <tr class="cp_txt">
                            <td><div class="obs"><?php echo $this->data['ORC_SOLOBS']; ?></div></td>
                        </tr>
                        <tr class="cp_txt">
                            <td><a href="<?php echo $this->urlmodulo.'/'.$this->controller; ?>" class="btn-pdr" >Voltar</a></td>
                        </tr>
                    </table>
                </div>
            </div>

            <div class="col2">
                <div class="status <?php echo dominio::getOrcamentoCor($this->data['ORC_STA']); ?>">
                    <span class="<?php //data ?>"><span class="sep"><label>Status: </label><?php echo dominio::getOrcamento($this->data['ORC_STA']); // Elementosform::select(dominio::Orcamento('0'),'ORC_STA','orcsta',$this->data['ORC_STA']); ?> </span> <span class="sep"><label>Data: </label><?php echo Datetools::amd_dma($this->data['ORC_DATAORC']); ?></span> <label>Hora: </label><?php echo substr($this->data['ORC_HORORC'],0,5); ?>
                </div>

                <div class="linha l1">

                    <div class="lcol1">
                        <table>
                            <tr>
                                <td><label>Cod. Produto:</label><?php echo $this->pro->PRO_ID; ?></td>
                            </tr>

                            <tr>
                                <td><label>Produto:</label><?php echo $this->pro->PRO_NOM; ?></td>
                            </tr>

                            <tr>
                                <td><label>Modelagem:</label><?php echo $this->pro->PRO_NOM; ?></td>
                            </tr>

                            <tr>
                                <td><label>Cor:</label>
                                    <?php
                                    $img = glob('public/upload/cor/'.$this->cor->COR_ID.'.*');
                                    if(!isset($img[0]) && strlen($this->cor->COR_COR) > 0) { ?>
                                        <span style="background-color: #<?php echo $this->cor->COR_COR; ?>" title="<?php echo $this->cor->COR_NOM; ?>"></span>
                                    <?php } elseif(isset($img[0])) { ?>
                                        <img src="<?php echo $this->urlbase.'/'.$img[0]; ?>" title="<?php echo $this->cor->COR_NOM; ?>" />
                                    <?php } ?>
                                    &nbsp;
                                    <?php echo $this->cor->COR_NOM; ?>
                                    &nbsp;&nbsp;&nbsp;
                                    Ref. <?php echo $this->cor->COR_REF; ?>
                                </td>
                            </tr>

                            <tr>
                                <td><label>Cor Detalhe:</label>
                                <?php 
                                foreach($this->cordet as $cor){

                                    $cordet = new Sistema_Model_DbTable_Cor();
                                    $cordet = $cordet->fetchRow('COR_ID ='.$cor->COR_ID);

                                    $img = glob('public/upload/cordetalhe/'.$cordet->COR_ID.'.*');
                                    if(!isset($img[0]) && strlen($cordet->COR_COR) > 0) { ?>
                                        <span style="background-color: #<?php echo $cordet->COR_COR; ?>" title="<?php echo $cordet->COR_NOM; ?>"></span>
                                    <?php } elseif(isset($img[0])) { ?>
                                        <img src="<?php echo $this->urlbase.'/'.$img[0]; ?>" title="<?php echo $cordet->COR_NOM; ?>"  />
                                    <?php } ?>
                                    &nbsp;
                                    <?php echo $cordet->COR_NOM; ?>
                                    &nbsp;&nbsp;&nbsp;
                                    Ref. <?php echo $cordet->COR_REF; ?>

                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                <?php } ?>
                                </td>
                            </tr>

                            <tr>
                                <td><label>Grade Tamanhos:</label></td>
                            </tr>
                            <tr class="cp_txt">
                                <td>
                                    <ul class="grade tam">
                                        <?php foreach($this->tamanho as $tam) { 
                                            $tm = new Sistema_Model_DbTable_Tamanhos();
                                            $tm = $tm->fetchRow('TAM_ID = '. $tam['TAM_ID']);
                                        ?>
                                        <li title="<?php echo $tm->TAM_DES; ?>">
                                            <?php echo $tm->TAM_NOM; ?>
                                        </li>
                                        <li class="val"><?php echo $tam->ORP_QTD; ?></li>
                                        <?php } ?> 
                                    </ul>
                                </td>
                            </tr>

                        </table>
                    </div>
                    <div class="lcol2">
                        <a href="<?php echo $this->urlbase. '/produto/detalhe/id/'.$this->pro->PRO_ID; ?>" class="btn-pdr" target="_blank">Ver Produto</a>
                    <?php
                        $pdf = glob('public/upload/orcamento/'.$this->data['ORC_ID'].'.*');
                        if(isset($pdf[0])){ 
                            $url = $this->urlbase.'/'.$pdf[0];
                            // está ocorrendo erro nessa forma, baixa o arquivo corrompido
                            //$url = $this->urlmodulo.'/'.$this->controller.'/download/id/'.$this->data['ORC_ID']; 
                    ?>
                        <a href="<?php echo $url; ?>" target="_blanck" class="btn-pdr" >Baixar Arquivo</a>
                    <?php } ?>
                    <?php
                        $pdf = glob('public/upload/orcamento/orcamento_'.$this->data['ORC_ID'].'*');
                        if(isset($pdf[0])){ 
                    ?>
                        <?php /* <a href="<?php echo $this->urlbase.'/'.$pdf[0]; ?>" class="btn-pdr" target="_blank" >Ver Orçamento</a> */ ?>
                        <a href="<?php echo $this->urlmodulo.'/'.$this->controller.'/orcamentospdf/id/'.$this->data['ORC_ID']; ?>" class="btn-pdr">Ver Orçamento</a>
                    <?php } ?>
                    </div>
                </div>

                <div class="linha l2">
                    <div class="lcol1">
                        <table>
                            <tr>
                                <td><label>Valor unitário:</label><input type="text" name="ORC_VLRUNI" value="<?php echo $this->data['ORC_VLRUNI']; ?>" class="valor" /></td>
                            </tr>
                            <tr>
                                <td><label>Valor total:</label><input type="text" name="ORC_VLRTOT" value="<?php echo $this->data['ORC_VLRTOT']; ?>" class="valor" /></td>
                            </tr>
                            <tr>
                                <td><label>Condições Pagamento:</td>
                            </tr>
                            <tr class="cp_txt">
                                <td><textarea name="ORC_CON"><?php echo $this->data['ORC_CON']; ?></textarea></td>
                            </tr>
                            <tr>
                                <td><label>Observação:</label></td>
                            </tr>
                            <tr class="cp_txt">
                                <td><textarea name="ORC_OBS"><?php echo $this->data['ORC_OBS']; ?></textarea></td>
                            </tr>
                            <?php if($this->data['ORC_STA'] >= 2){?>
                            <tr>
                                <td><label><?php echo elemform::radio('ORC_STA','rorc_sta','3', $this->data['ORC_STA'])?> Vendido</label> <span class="br_rorc"></span> <label><?php echo elemform::radio('ORC_STA','rorc_sta','4', $this->data['ORC_STA'])?> Não Vendido</label></td>
                            </tr>
                            <?php } ?>
                        </table>
                    </div>
                    <div class="lcol2">
                        <?php
                            $btn = 'Orçar';
                            if($this->data['ORC_STA'] > 1) $btn = 'Reenviar';
                        ?>
                        <a class="btn-pdr btn-enviar-orc" href="javascript:void(0)"><?php echo $btn; ?></a>
                        
                        <?php /* <a class="btn-pdr btn-orc-salvar" href="javascript:void(0)">Salvar</a> */?>
                    </div>
                </div>

            </div>        
    </div>
</form>